package t1;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 调用各类方法
 *
 */
public class Tools {
	private static List<StudentBean> studentList = new ArrayList<StudentBean>();
	{
		Deserialization ss = new Deserialization();
		try {
			studentList = ss.deserialization();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void add(Scanner cin) {
		AddStudent addStudent = new AddStudent();
		System.out.println("请输入姓名");
		String name = cin.nextLine();
		System.out.println("请输入专业");
		String major = cin.nextLine();
		studentList = addStudent.addStudent(studentList, name, major);

	}

	public void outStudentByName(Scanner cin) {
		String name = cin.nextLine();
		SelectStudentByName ssbn = new SelectStudentByName();
		ssbn.selectStudentByName(studentList, name);
	}

	public void outStudentByMajor(Scanner cin) {
		String major = cin.nextLine();
		SelectStudentByMajor ssbm = new SelectStudentByMajor();
		ssbm.selectStudentByMajor(studentList, major);
	}

	public void outAllStudent() {
		SelectAllStudent sas = new SelectAllStudent();
		sas.selectAllStudent(studentList);
	}

	public void quite() {
		Serialize sl = new Serialize();
		try {
			sl.serialize(studentList);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
